/*
 * @Author: yanjikun
 * @Date: 2022-05-16 11:12:58
 * @LastEditors: yanjikun
 * @LastEditTime: 2022-06-13 16:14:47
 * @Description: file content
 */

import { api } from '@/api'
import { YAxios } from '@/utils/http/request'

export function menuList(params?: API.MenuTableParams) {
  return YAxios<API.TableListType<API.MenuResult>>({
    url: `${api.menuRights}/list`,
    method: 'get',
    params,
  })
}

export function menuUpdate(params: API.MenuCreateParams) {
  return YAxios(
    {
      url: `${api.menuRights}/${params.id}`,
      method: 'put',
      data: params,
    },
    { successMsg: '修改成功！' },
  )
}

export function menuCreate(params: API.MenuCreateParams) {
  return YAxios(
    {
      url: `${api.menuRights}`,
      method: 'post',
      data: params,
    },
    { successMsg: '新增成功！' },
  )
}

export function menuDelete(params: API.MenuDeleteParams) {
  return YAxios(
    {
      url: `${api.menuRights}/${params.id}`,
      method: 'delete',
    },
    { successMsg: '删除成功！' },
  )
}
